import 'package:flutter/material.dart';

class gridviewPage extends StatelessWidget {
   gridviewPage({super.key});

  List names = ["张三","李四","王五","赵六","孙七","周八"];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("网格页"),),
      //crossAxisCount代表每一行的数量
      body: GridView.builder(
          itemCount: 64,
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 8),
          itemBuilder: (context, index)=> Container(
            color: Colors.deepPurple,
            margin: EdgeInsets.all(5),
          )
      ),
    );
  }
}
